<template>
	<view class="profileInfoBox">
		<view class="profileTopBar">
			<view :class="[{active:activeIndex==index},'profileTopBar_item']" @click="test(index)"
				v-for="(item, index) in topBar" :key="index">{{item}}</view>
		</view>
		<profile-info-detail :activeIndex="activeIndex" :currentList="currentList"></profile-info-detail>
	</view>
</template>

<script>
	import profileInfoDetail from '@/components/profileInfo/profileInfoDetail.vue'
	
	export default {
		name: 'profileInfo',
		components:{
			profileInfoDetail
		},
		props:{
			list:{
				type:Object,
				default:{}
			}
		},
		data() {
			return {
				topBar: ['我的发布', '我的喜欢', '浏览历史'],
				activeIndex: 0,
				currentList:[]
			}
		},
		methods: {
			test(index) {
				console.log(index);
				this.activeIndex = index
				if(index == 0){
					this.currentList = this.list.list.myRelease
					// console.log('myRelease', this.currentList);
				}else if(index == 1){
					this.currentList = this.list.list.myLikes
					// console.log('myLikes', this.currentList);
				}else{
					this.currentList = this.list.list.myCookies
					// console.log('myCookies', this.currentList);
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.profileInfoBox {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100vw;
		background-color: white;
		position: relative;
		top: 0rpx;
		z-index: 1;
		border-radius: 30rpx 30rpx 0 0;
		padding-top: 130rpx;

		.profileTopBar {
			width: 100vw;
			display: flex;
			justify-content: space-around;
			margin-bottom: 30rpx;

			.profileTopBar_item {
				width: 150rpx;
				height: 150rpx;
				border-radius: 30rpx;
				text-align: center;
				line-height: 150rpx;
				// font-weight: bold;
				font-size: 28rpx;
				background-color: white;
				box-shadow: 0 0 10rpx #b6b6b6;
			}
			// 点击后效果
			.active {
				color: white;
				background-color: #5a53c8;
			}
		}
	}
</style>
